package objects 
{
	import starling.display.Image;
	import starling.display.MovieClip;
	import starling.core.Starling;
	import starling.events.Event;
	/**
	 * ...
	 * @author Tuan
	 */
	public class TestAnimation extends MyObject
	{
		private var m_moveMovie : MovieClip;
		private var image :Image;
		private var time : Number ;
		public function TestAnimation() 
		{
			
			this.addEventListener(Event.ADDED_TO_STAGE, init);
			
		}
		protected function init(event:Event):void
		{
			time = 0;
			m_moveMovie = new MovieClip(Assets.getAtlas().getTextures("attack_"), 8);
			
			m_moveMovie.pivotX =  m_moveMovie.width / 2;
			m_moveMovie.pivotY =  m_moveMovie.height / 2;
			
			//m_moveMovie.scaleX = 0.3;
			//m_moveMovie.scaleY = 0.3;
			m_moveMovie.x = 500;
			m_moveMovie.y = 500;
			m_collision = false;
			
			Starling.juggler.add(m_moveMovie);
			this.addChild (m_moveMovie);

		}
		override public function update (dt: Number) : void
		{
			if (m_collision == true)
			{
				time += dt;
				if ( time >= 0.5)
				{
					time = 0;
					m_collision = false;
				}
			}
			if ( m_moveMovie.currentFrame >=3 && m_moveMovie.currentFrame <= 5 && m_collision ==false)
			{
				m_collision = true;
				
			}
		}
	}

}